////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file   CollabRCBotUnitTests\MockConstantTreeNode.cpp
///
/// @brief  Defines the implementation of the MockConstantTreeNode class
////////////////////////////////////////////////////////////////////////////////////////////////////

#include "MockConstantTreeNode.h"
#include "../CollabRCBot/exceptions.h"

/**
 * @brief Creates a new MockConstantTreeNode representing the specified constant value
 * @param constant the value to represent
 */
MockConstantTreeNode::MockConstantTreeNode(float constant):m_constant(constant)
{
}

/**
 * @brief Creates a MockConstantTreeNode which is a duplicate of the specified
 * one.
 * @param copy the MockConstantTreeNode to duplicate
 */
MockConstantTreeNode::MockConstantTreeNode(const MockConstantTreeNode& copy):m_constant(copy.m_constant)
{
}

/** @brief destroys this MockConstantTreeNode and associated resources */
MockConstantTreeNode::~MockConstantTreeNode(void)
{
}

/** {@inheritDoc} */
CollabRC::Bot::AI::ComputationalTreeNode* MockConstantTreeNode::Clone() const
{
    return new MockConstantTreeNode(*this);
}

/** {@inheritDoc} */
CollabRC::Bot::AI::ComputationalTreeNode* MockConstantTreeNode::Mutate(unsigned int depth) const
{
    CollabRC::Bot::AI::IllegalMutationException ex;
    throw ex;
}

/** {@inheritDoc} */
const CollabRC::Bot::AI::ComputationalTreeNode& MockConstantTreeNode::GetRandomBranch(unsigned int depth) const
{
    return *this;
}

/** {@inheritDoc} */
unsigned int MockConstantTreeNode::GetBranchDepth() const
{
    return 1;
}

/** {@inheritDoc} */
float MockConstantTreeNode::Compute() const
{
    return m_constant;
}

void MockConstantTreeNode::Accept(CollabRC::Bot::AI::ComputationalTreeNodeVisitor& visitor)
{
    // Do nothing
}
